<#include "/layout/header.ftl" />
<#import "/include/ui.ftl" as blue />

<script>

$(function()
{
	
});

function save_click()
{
	$.simpleValid("#div_form", function(obj)
	{
		$.simpleAjax("/cms/channel_save", obj, function(o)
		{
			$.successAlert("保存成功", "save_success()", 2000);
		});
	});
}
function save_success()
{
	window.location = "${path}/cms/channel_list?webId=${model.webId!}";
}
</script>

<div class="am-form am-form-horizontal am-cf am-margin" id="div_form">
<input type="hidden" name="id" value="${model.id!}"/>
<input type="hidden" name="parentId" value="${model.parentId!}"/>
<input type="hidden" name="webId" value="${(web.id)!}"/>

	<fieldset>
		<legend><#if model.id??>修改<#else>添加</#if>栏目<#if parentModel??>－上级栏目：${parentModel.name!}</#if>－网站：${(web.name)!}</legend>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">标识</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="code" placeholder="输入栏目标识" class="am-form-field am-radius"  maxlength="20" value="${model.code!}"/>
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">名称</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="name" placeholder="输入栏目名称" class="am-form-field am-radius"  maxlength="50" value="${model.name!}" required/>
				</div>
			</div>
		</div>

		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">模型</label>
				<div class="am-u-md-9 am-u-end">
					<select class="am-form-field am-radius" name="type" data-am-selected="{'btnWidth': '150px'}" required>
						<@blue.select list=map.cmsDocModel value=(model.model.index)!"1" />
					</select>
				</div>
			</div>
		</div>

		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">类型</label>
				<div class="am-u-md-9 am-u-end">
					<select class="am-form-field am-radius" name="type" data-am-selected="{'btnWidth': '150px'}" required>
						<@blue.select list=map.cmsChannelType value=(model.type.index)!"1" />
					</select>
				</div>
			</div>
		</div>

		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">状态</label>
				<div class="am-u-md-9 am-u-end">
					<select class="am-form-field am-radius" name="state" data-am-selected="{'btnWidth': '120px'}" required>
						<@blue.select list=map.state value=(model.state.index)!"0" />
					</select>
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">排序</label>
				<div class="am-u-md-9 am-u-end">
					<input type="number" name="sort" placeholder="输入栏目排序" class="am-form-field am-radius"  maxlength="10" value="${model.sort!"0"}" required/>
				</div>
			</div>
		</div>
	
		<div class="am-u-md-12">
			<div class="am-form-group">
				<label class="am-u-md-1 am-form-label am-padding-left-0 am-padding-right-0">描述</label>
				<div class="am-u-md-10 am-u-end">
					<textarea name="descp" placeholder="输入栏目描述" class="am-form-field am-radius" style="height: 100px;"
						maxlength="500">${model.descp!}</textarea>
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">文档数</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" class="am-form-field am-radius" value="${model.docs!}" readonly/>
				</div>
			</div>
		</div>

		<div class="am-u-md-12 am-text-center div_btn">
			<a href="javascript:void(0)" onclick="save_click()" class="am-btn am-btn-primary am-radius">保存</a>
			<a href="javascript:void(0)" onclick="save_success()" class="am-btn am-btn-default am-radius am-margin-left">返回</a>
		</div>
	</fieldset>
</div>

<#include "/layout/footer.ftl" />